<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body id="body">

<div id="console"></div>

<script>
    if (window.internals)
        internals.enableMockSpeechSynthesizer(window);

    if (window.testRunner)
        testRunner.waitUntilDone();

    window.jsTestIsAsync = true;

    description("This tests that we can get synthesizer voices on the Mac");

    var list;
    speechSynthesis.onvoiceschanged = function() {
        list = speechSynthesis.getVoices();
        continueTest();
    }

    var foundDefaultVoice;
    var foundEnglishVoice;
    var voiceCount;

    function continueTest() {
        list = speechSynthesis.getVoices();

        foundDefaultVoice = false;
        foundEnglishVoice = false;
        voiceCount = list.length;

        for (var k = 0; k < list.length; k++ ) {
            var voice = list[k];
            if (voice.lang == "en-US") {
                foundEnglishVoice = true;
            }
            if (voice.default) {
                foundDefaultVoice = true;
            }
        }

        shouldBeTrue("voiceCount > 0");
        shouldBeTrue("foundEnglishVoice");
        shouldBeTrue("foundDefaultVoice");

        finishJSTest();
    }
</script>

</body>
</html>
